package org.lanqiao.taru.dao;

import org.apache.ibatis.annotations.Select;
import org.lanqiao.taru.domain.TbArticle;
import org.lanqiao.taru.vo.TbArticleVo;
import tk.mybatis.mapper.common.Mapper;

public  interface ArticleMapper  extends Mapper<TbArticle> {


    /**
     * 根据文章的编号查询文章信息
     * @param id
     * @return
     */

    @Select("SELECT\n" +
            "\t art.id,\n" +
            "\t art.atc_content  as  atcContent,\n" +
            "  art.atc_title as  atcTitle,\n" +
            "  art.atc_face as atcFace,\n" +
            "  art.atc_user_Id as atcUserId ,\n" +
            "  art.atc_create_date as atcCreateDate,\n" +
            "  art.atc_category_id  as atcCategoryId ,\n" +
            "\t ur.realname\n" +
            "FROM\n" +
            "\t tb_article art\n" +
            "LEFT JOIN tb_userinfo ur ON art.atc_user_Id = ur.id\n" +
            "WHERE\n" +
            "\t art.id = #{id}")
    TbArticleVo getInfoById(Long  id);


    /**
     * SQL在xml中
     * @param id
     * @return
     */
    TbArticleVo getInfoById2(Long  id);




}
